package com.vitabuybuy.tv.ui.tencent.superplay

import android.os.Bundle
import androidx.core.os.bundleOf
import com.library.common.base.BaseActivity
import com.library.common.base.BaseViewModel
import com.vitabuybuy.tv.R
import com.vitabuybuy.tv.databinding.ActivitySuperPalayVideoBinding
import kotlinx.android.synthetic.main.activity_super_palay_video.*


/**
 * 作者：SimGa
 * 日期：2021/5/5
 * 时间：23:47
 * 包名：com.vitabuybuy.tv.ui.tencent
 */

class SuperPlayVidelMainActivity : BaseActivity<BaseViewModel, ActivitySuperPalayVideoBinding>() {
    override val isUseBaseTitleBar: Boolean
        get() = true
    override val layoutId: Int
        get() = R.layout.activity_super_palay_video

    private var playUrl: String? = ""
    private var mCoverUrl: String? = ""
    private var mTitle: String? = null

    override fun onGetBundle(bundle: Bundle?) {
        playUrl = bundle?.getString("playUrl")
        mCoverUrl = bundle?.getString("mCoverUrl")
        mTitle = bundle?.getString("title")
    }

    override fun initView(savedInstanceState: Bundle?) {
        setTitle(mTitle ?: getString(R.string.video_play))
        (playback_fragment as PlaybackFragment).setUrl(mCoverUrl, playUrl)
    }

    companion object {
        fun openActivity(mContext: BaseActivity<*, *>, playUrl: String?, mCoverUrl: String?) {
            mContext.startActivity(
                bundleOf(Pair("playUrl", playUrl), Pair("mCoverUrl", mCoverUrl)),
                SuperPlayVidelMainActivity::class.java
            )
        }

        fun openActivity(
            mContext: BaseActivity<*, *>,
            playUrl: String?,
            mCoverUrl: String?,
            title: String?
        ) {
            mContext.startActivity(
                bundleOf(
                    Pair("playUrl", playUrl),
                    Pair("mCoverUrl", mCoverUrl),
                    Pair("title", title)
                ),
                SuperPlayVidelMainActivity::class.java
            )
        }
    }
}